'''
pygeom -- Python Geometric Engine
matrix -- Definition of the Matrix

The Matrix is an ordered set of Vectors of equal length, making it
a "box" of numbers. There are plenty of things that can be done
with Matrices in pygeom, but I've been a bit lazy and left work that
can be done with Vectors to be done with Vectors. The biggest reason
for implementing this is for the Determinant of a Matrix.

To this end, only a 3x3 Matrix is supported. For now.
'''

#Yes. I know. This is an insult to mathematics everywhere.

from __future__ import division
from pygeom import vector

class Matrix(object):
    def __init__(self, v1, v2, v3):
        self.v1=v1
        self.v2=v2
        self.v3=v3
    @classmethod
    def FromReal(cls, a1, a2, a3, b1, b2, b3, c1, c2, c3):
        return cls(vector.Vector(a1, a2, a3),
                   vector.Vector(b1, b2, b3),
                   vector.Vector(c1, c2, c3))
    @property
    def Determinant(self):
        return ((self.v1.x*self.v2.y*self.v3.z)+
                (self.v1.y*self.v2.z*self.v3.x)+
                (self.v1.z*self.v2.x*self.v3.y)-
                (self.v1.z*self.v2.y*self.v3.x)-
                (self.v1.x*self.v2.z*self.v3.y)-
                (self.v1.y*self.v2.x*self.v3.z))